<?php

namespace SinoPHP\BbdBoss\Model;

use Upfor\UpforPHP\Model;

class CustomerDomainTemplateRecord extends Model {

    public function __construct() {
        parent::__construct();
    }

    /**
     * 批量插入数据
     * 
     * @param  array  $data
     * @param  mixed  $replace 
     * @return integer
     */
    public function bulkInsert(array $data, $replace = null) {
        return $this->insert($data, $replace);
    }

    /**
     * 获取模板记录信息
     * 
     * @param  array  $data
     * @return array
     */
    public function getTemplateRecordInfo(array $data) {
        $cols = [
            'template_record_id',
            'template_id',
            'record_line_name',
            'record_line_id',
            'record_type',
            'master_record',
            'bak_record',
            // 'ttl',
            'status'
        ];
        return $this->getRow($cols, $data);
    }

    /**
     * 获取模板记录列表
     * 
     * @param  array  $data
     * @return array
     */
    public function getTemplateRecordList(array $data) {
        $cols = [
            'template_record_id',
            'template_id',
            'record_line_name',
            'record_line_id',
            'record_type',
            'master_record',
            'bak_record',
            'ttl',
            'status',
            'dnspod_id'
        ];
        $orderBy = [
            'record_line_id' =>  'ASC'
        ];

        return $this->getList($cols, $data, $orderBy);
    }
}
